home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / doc / libnet-dbus-perl / examples / example-client-no-introspect.pl < prev    next >
Encoding:
Perl Script  |  2008-02-20  |  666 b   |  27 lines

  1. #/usr/bin/perl
  2.  
  3. use warnings;
  4. use strict;
  5.  
  6. use Net::DBus;
  7. use Carp qw(cluck carp);
  8. #$SIG{__WARN__} = sub { cluck $_[0] };
  9. #$SIG{__DIE__} = sub { carp $_[0] };
  10.  
  11. my $bus = Net::DBus->session();
  12.  
  13. my $service = $bus->get_service("org.designfu.SampleService");
  14. my $object = $service->get_object("/SomeObject", "org.designfu.SampleInterface");
  15.  
  16. my $list = $object->HelloWorld("Hello from example-client.pl!");
  17.  
  18. print "[", join(", ", map { "'$_'" } @{$list}), "]\n";
  19.  
  20. my $tuple = $object->GetTuple();
  21.  
  22. print "(", join(", ", map { "'$_'" } @{$tuple}), ")\n";
  23.  
  24. my $dict = $object->GetDict();
  25.  
  26. print "{", join(", ", map { "'$_': '" . $dict->{$_} . "'"} keys %{$dict}), "}\n";
  27.